package com.cms.admin.service.healthrecord.impl;

import com.cms.admin.mapper.GoodsDataUserRemarkMapper;
import com.cms.admin.model.GoodsDataUserRemark;
import com.cms.admin.model.GoodsDataUserRemarkExt;
import com.cms.admin.model.PageBean;
import com.cms.admin.service.healthrecord.GoodsDataUserRemarkService;

import java.util.List;

public class GoodsDataUserRemarkServiceImpl implements GoodsDataUserRemarkService{

    private GoodsDataUserRemarkMapper goodsDataUserRemarkMapper;

    @Override
    public List<GoodsDataUserRemark> queryGoodsDataUserRemarkList(PageBean page, GoodsDataUserRemarkExt example) {
        long count = getRowCount(example);
        page.setAllRow(count);
        example.setOffset(page.getOffset());
        example.setPageSize(page.getPageSize());
        return goodsDataUserRemarkMapper.selectBySelectiveWithLimit(example);
    }

    @Override
    public List<GoodsDataUserRemark> queryGoodsDataUserRemarkList(GoodsDataUserRemarkExt example) {
        return goodsDataUserRemarkMapper.selectBySelective(example);
    }

    @Override
    public long getRowCount(GoodsDataUserRemarkExt example) {
        return goodsDataUserRemarkMapper.countBySelective(example);
    }

    @Override
    public int deleteGoodsDataUserRemark(Long recid) {
        return goodsDataUserRemarkMapper.deleteByPrimaryKey(recid);
    }

    @Override
    public int addGoodsDataUserRemark(GoodsDataUserRemark record) {
        return goodsDataUserRemarkMapper.insertSelectiveAndGetId(record);
    }

    @Override
    public GoodsDataUserRemark queryGoodsDataUserRemark(Long recid) {
        return goodsDataUserRemarkMapper.selectByPrimaryKey(recid);
    }

    @Override
    public int updateGoodsDataUserRemark(GoodsDataUserRemark record) {
        return goodsDataUserRemarkMapper.updateByPrimaryKeySelective(record);
    }

    public GoodsDataUserRemarkMapper getGoodsDataUserRemarkMapper() {
        return goodsDataUserRemarkMapper;
    }

    public void setGoodsDataUserRemarkMapper(GoodsDataUserRemarkMapper goodsDataUserRemarkMapper) {
        this.goodsDataUserRemarkMapper = goodsDataUserRemarkMapper;
    }
}
